﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="selectuser.aspx.cs" Inherits="Runda.CMS.Portal.Lookup.selectuser" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../Content/global.css" />
    <link rel="stylesheet" type="text/css" href="../Content/Dialog/Dialogs.css" />
    <link rel="stylesheet" type="text/css" href="../Content/Tree/tree.css" />
    <script type="text/javascript" src="../Content/lookup/map_LookupDialogs.js"></script>
    <script type="text/javascript">
        function win_load() {
            //Table1.focusNodeByValue(mapForm.txtBldGUID.value);
        }


        // 确定返回
        // 返回用户信息字符串：用户GUID;用户名称
        function okClick() {
            if (Table1.value == null || Table1.value == "") {
                alert("该公司下没有用户被选择！");
                return;
            }

            if (document.all("__lookup")) {
                if (document.all("__lookup").value == "1")		// 如果采用 lookup 方式打开
                {
                    var ls = new LookupItems();
                    var li = new LookupItem();

                    li.id = Table1.value;
                    li.name = "ParentId";
                    li.html = "<img class='lui' src='/Images/ico_16_8_d.gif'>" + Table1.text;
                    li.values = null;
                    li.keyValues = null;

                    ls.items.push(li);

                    window.returnValue = ls;
                }
            }
            else {
                var arrReturn;

                sReturn = Table1.value;
                sReturn = sReturn + ";" + Table1.text;              
                window.returnValue = sReturn;
            }

            window.close();
        }


        // 将复选框的值保存在文本框中，之间用 ";" 分隔
        function getCBLReasonStr() {
            var sReason = "";

            for (var i = 0; i < SltCBLReason.cells.length; i++) {
                if (SltCBLReason.rows[0].cells[i].children[0].checked) {
                    sReason += SltCBLReason.rows[0].cells[i].children[1].innerText + ";";
                }
            }
            if (sReason != "") {
                mapForm.CBLReason.value = sReason.substr(0, sReason.length - 1);
                return true;
            }
        }
		</script>
</head>
<body>
    <form id="form1" runat="server">
       <asp:ScriptManager ID="ScriptManager1" runat="server">
                                </asp:ScriptManager>
    <div>
        <input name="txtBldGUID" type="text" id="txtBldGUID" style="display: none" />
        <table width="100%" cellspacing="0" cellpadding="0" height="100%">
            <tr>
                <td class="main">
                    <table width="100%" cellspacing="0" cellpadding="0" height="100%">
                        <colgroup>
                            <col width="45">
                            <col>
                        </colgroup>
                        <tr height="1">
                            <td>
                                <b style="color: #666666">员工:</b>
                            </td>
                            <td>
                                   <asp:TextBox runat="server" ID="userNameOrCode"></asp:TextBox>&nbsp<asp:Button ID="btnQuery" CssClass="button"  runat="server" Text="查询" OnClick="query" />          
                            </td>
                        </tr>
                        <tr height="15">
                            <td colspan="2">
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" class="wizBox1">
                                <div style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px; overflow: auto;
                                    width: 100%; padding-top: 5px; height: 100%">
                                      <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
                                        <ContentTemplate>
                                    <asp:Repeater ID="RepeaterUsers" runat="server" >
                                       <HeaderTemplate>
                                            <table id="Table1" cellspacing="0" cellpadding="0" width="100%" class="singleSelectTree">
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <tr height='20' code='1' value='<%# Eval("UserID") %>' text='<%# Eval("UserName") %>'
                                                allowselect='1' is_hide="false" onclick="Table1.clickNode(this)" ondblclick="okClick()"
                                                onmouseover='this.bgColor="#E3E9F4"' onmouseout='this.bgColor="#ffffff"'>
                                                <td>
                                                    <span></span>
                                                    <label style="cursor: hand">
                                                    </label>
                                                    <img src='/Images/ico_16_8_d.gif'><%#Eval("UserName")%>
                                                </td>
                                            </tr>
                                        </ItemTemplate>
                                        <FooterTemplate>
                                            </table>
                                        </FooterTemplate>
                                    </asp:Repeater>
                                       </ContentTemplate>
                                        <Triggers>
                                            <asp:AsyncPostBackTrigger ControlID="btnQuery" EventName="Click" />
                                        </Triggers>
                                    </asp:UpdatePanel>
                                    <input name="repUser$txtSort" type="text" onchange="javascript:setTimeout('__doPostBack(\'repUser$txtSort\',\'\')', 0)"
                                        onkeypress="if (WebForm_TextBoxKeyHandler(event) == false) return false;" id="repUser_txtSort"
                                        style="display: none;" /><input name="repUser$txtLocation" type="text" id="repUser_txtLocation"
                                            style="display: none;" />
                                </div>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr height="40">
                <td class="buttons">
                    <button style="width: 70px;" onclick="okClick()" id="btnOk" type="button" class="button">
                        确 定</button>&nbsp;&nbsp;
                    <button style="width: 70px;" onclick="parent.window.close();" type="button" class="button">
                        取 消</button>
                </td>
            </tr>
        </table>
        <input type="hidden" id="__lookup" name="__lookup" value="1">;
    </div>
    </form>
</body>
</html>
